package cn.redis;

import redis.clients.jedis.Client;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;

/**
 * 订阅者消息处理器
 */
public class MyMsgListener  extends JedisPubSub {


//    private Jedis jedis = new Jedis("127.0.0.1");

    @Override
    public void proceed(Client client, String... channels) {
        super.proceed(client, channels);
    }

    @Override
    public void onMessage(String channel, String message) {
//        System.out.println("****channel="+channel+",message="+message);
        //消息处理函数

        if(channel.equals("newUserRequest")){
            //
            System.out.println("****channel="+channel+",message="+message);
            int[] arr = new int[5];
            for (int i = 0 ; i < arr.length ;i++){
                //发布消息
                System.out.println("************in发布消息");
                Test2.jedis.publish("newPush", "phoneNumber,msg.......");
            }

        }else if(channel.equals("newPush")){
            //
            System.out.println("fires interface to push.......");
        }



        super.onMessage(channel, message);
    }
}
